package com.ruoyi.web.controller.authentication;


import com.hxzy.authentication.domain.TsCarCard;
import com.hxzy.authentication.service.TsCarCardService;
import com.ruoyi.common.annotation.Anonymous;
import com.ruoyi.common.annotation.DataSource;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.DataSourceType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author mingqian.Wu
 * @since 2023-06-23
 */
@DataSource(DataSourceType.AUTHENTICATION)
@RestController
@RequestMapping("/tsCarCard")
public class TsCarCardController {

    @Value("${oss-img-path}")
    private String ossImgPath;

    @Autowired
    private TsCarCardService tsCarCardService;

    //获取图片
    @Anonymous
    @GetMapping("/getCarCard")
    public AjaxResult getCarCard(@RequestParam String authenticationId){
        TsCarCard byId = tsCarCardService.getById(authenticationId);
        //主车行驶证正
        byId.setTravelCardFront(ossImgPath+byId.getTravelCardFront());
        //主车行驶证反
        byId.setTravelCardOpposite(ossImgPath+byId.getTravelCardOpposite());
        //主车道路运输证
        byId.setTransportCertificate(ossImgPath+byId.getTransportCertificate());
        //道路运输经营许可证
        byId.setTransportationBusinessLicense(ossImgPath+byId.getTransportationBusinessLicense());
        //购车合同首页
        byId.setCarPurchaseContractFirst(ossImgPath+byId.getCarPurchaseContractFirst());
        //购车合同尾页
        byId.setCarPurchaseContractEnd(ossImgPath+byId.getCarPurchaseContractEnd());
        //人车合照
        byId.setGroupPhoto(ossImgPath+byId.getGroupPhoto());
        //机动车交强险保险照片
        byId.setMotorVehicleCompulsoryInsurance(ossImgPath+byId.getMotorVehicleCompulsoryInsurance());
        return AjaxResult.success(byId);
    }


}

